#pragma once	
#include "common.h"
#include "objectpool.h"
class PageCache
{
private:
	spanlist _pagespanlistarray[npages];

	std::unordered_map<Page_ID, span*> _id_span_map;

	static PageCache _sInst;//全局只有一个PageCache，所以定义为单例模式
	PageCache()
	{}
	PageCache(PageCache&) = delete;
public:
	std::mutex _pagemtx;//锁	
	span* newspan(size_t k);//获取一个k页的span
	static PageCache* GetInstance()
	{
		return &_sInst;
	}
	span* map_obj_to_span(void* obj);
	void Realse_span_to_page(span*  sp);
};